import org.apache.commons.dbcp.BasicDataSource;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.sql.SQLException;

/**
 * Created by Administrator on 2016/3/10 0010.
 */
public class test {

    private ApplicationContext applicationContext = null;

    @Before
    public void init(){
        applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
    }

    @Test
    public void client() throws SQLException {
        BasicDataSource basicDataSource = applicationContext.getBean(BasicDataSource.class);
        System.out.print(basicDataSource.getConnection());
    }
}
